package com.bicon.botu.finance.wallet;

import com.bicon.botu.core.base.annotation.*;
import com.bicon.botu.core.base.config.SystemInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * 应用启动类
 */
@SpringBootApplication
@EnableGlobalRedis
@EnableMyBatisPlusConfig // MyBatis配置
@MapperScan("com.bicon.botu.finance.wallet.mapper") //扫描mapper
@EnableHttpLogAspect //http请求日志
@EnableGlobalExceptionHandler //统一异常处理
@EnableSystemInterceptor //系统拦截器
@EnableScheduling //开启定时任务
public class WalletApplication extends WebMvcConfigurationSupport {

    public static void main(String[] args) {
        SpringApplication.run(WalletApplication.class,args);
    }


    @Bean
    public SystemInterceptor getMyInterceptor(){
        return new SystemInterceptor();
    }

    /**
     * 配置拦截器
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(getMyInterceptor()).addPathPatterns("/**");
    }
}
